local langyi = fk.CreateSkill{
  name = "qsjx__langyi",
}

Fk:loadTranslationTable{
  ["qsjx__langyi"] = "狼异",
  [":qsjx__langyi"] = "出牌阶段开始时，你可令其他角色依次选择是否交给你一张牌，选择否的角色于此阶段视为在你攻击范围内。",
  ["@[player]langyi-phase"] = "狼异",
  ["#qsjx__langyi-give"] = "请交给%src一张牌，否则此阶段视为在%src攻击范围内",

  ["$qsjx__langyi1"] = "狼顾大漠三十载，汉家城池尽膻腥！",
  ["$qsjx__langyi2"] = "铁骑踏碎长安月，岂效汉儒读春秋？",
}

langyi:addEffect(fk.EventPhaseStart, {
  anim_type = "offensive",
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(langyi.name) and player.phase == Player.Play
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    for _, p in ipairs(room:getOtherPlayers(player)) do
      local cards = room:askToCards(p, {
        min_num = 1,
        max_num = 1,
        include_equip = true,
        pattern = ".",
        prompt = "#qsjx__langyi-give:"..player.id,
        skill_name = langyi.name,
        cancelable = true,
      })
      if #cards > 0 then
        room:obtainCard(player, cards, true, fk.ReasonGive, player.id, langyi.name)
      else
        room:addTableMark(player, "@[player]langyi-phase", p.id)
      end
    end
  end,
})



langyi:addEffect("atkrange", {
  within_func = function(self, from, to)
    return from:hasSkill(langyi.name) and table.contains(from:getTableMark("@[player]langyi-phase"), to.id)
  end,
})

return langyi